﻿@model BankApp.Models.ExternalOperationModel

@{
    ViewBag.Title = "SetAmount";
    Layout = "~/Views/Shared/_Transfer_Menu.cshtml";
}

<h2>Set Amount</h2>
<h2>Card #@ViewBag.Transfer.CardNumber</h2>

@{
    if (ViewBag.Errors != null)
    {
        <span style="color: red;">@ViewBag.Errors</span>
    }
}
    <p>Please, specify amount and currency you'd like to transfer </p>
    @Html.TextBoxFor(m => m.Amount, new { id = "_amount" })
    @Html.ValidationMessageFor(m => m.Amount)
    <br/>
    @Html.DropDownListFor(m => m.Type, new SelectList(new[] { "Deposit", "Withdraw" }), new { id = "_type"})
    <br/>
    
    <input type="submit" onclick="return submitTransferForm()" value="Process"/>


<script type="text/javascript">
    function submitTransferForm() {
        var amount = $('#_amount').attr('value');
        var type = $('#_type').attr('value');
        $('#transferForm').attr('action', '/Transfers/Transfer');
        $('#transferForm #amount').attr('value', amount);
        $('#transferForm #type').attr('value', type);
        $('#transferForm').submit();
        return false;
    }
</script>